package com.atguigu.boot;

import com.atguigu.boot.bean.Car;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author:朱思博
 * @date:2021/5/4-{13:41}
 */

@RestController // 代替@Controller和@ResponseBody注解
public class HelloController {


    @RequestMapping("/hello")
    public String handle01() {
        return "hello SpringBoot"+"你好";
    }

    @Autowired
    Car car;
    // 该方法用来测试配置绑定@ConfigurationProperties(prefix = "mycar")注解
    @RequestMapping("/car")
    public Car car() {
        return car; // {"brand":"BYD","price":10000}
    }
}
